import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import { environment } from '../../../environments/environment';

@Injectable({
  providedIn: 'root'
})
export class ApiService {
  private apiUrl = environment.apiUrl;

  constructor(private http: HttpClient) {}

  getProblems(): Observable<any> {
    return this.http.get(`${this.apiUrl}/problems`);
  }

  getProblem(id: number): Observable<any> {
    return this.http.get(`${this.apiUrl}/problems/${id}`);
  }

  // 添加其他API方法...
}
